home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / filutil / mdf130.zip / MDFL130.ZIP / MDFL_ENG.DOC < prev    next >
Text File  |  1995-01-12  |  8KB  |  286 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.                                        MDFLIB
  16.                                      Version 1.3
  17.  
  18.  
  19.                              (C) 1994/95 Maurizio Giunti
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.      C++ library to apply *.MDF patch files produced with a REGISTERED copy of
  30.      MDIFF/MDIFF2. Both  Dos and OS/2 32bits versions. MDFLIB is  totally free
  31.      of charge, and royalty free.
  32.      MDFLIB can be  freely distributed at  no cost, except  for eventual  copy
  33.      and/or shipping  expensee.  It is  imperative  anyway that  the  ORIGINAL
  34.      PACKET is distributed without any modification WHATSOEVER.
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.                                       WARNING:
  45.        MDFLIB will work ONLY on *.MDF files produced with a REGISTERED copy of
  46.                                     MDIFF/MDIFF2.
  47.  
  48.  
  49.  
  50.  
  51.  
  52.      0.INDEX
  53.  
  54.  
  55.      0.INDEX                                                                  2
  56.  
  57.  
  58.      1.USE CONDITIONS                                                         3
  59.  
  60.  
  61.      2.C++                                                                    3
  62.  
  63.        2.1.MPatch CLASS                                                       3
  64.  
  65.        2.2.ERROR TABLE                                                        3
  66.  
  67.        2.3.READING THE HEADER                                                 4
  68.  
  69.  
  70.      3.C                                                                      4
  71.  
  72.        3.1.READING THE HEADER                                                 4
  73.  
  74.        3.2.APPLY THE PATCH                                                    5
  75.  
  76.  
  77.      4.VISUAL BASIC                                                           5
  78.  
  79.  
  80.      5.AUTHOR'S ADDRESS                                                       5
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.                                                                               2
  107.  
  108.  
  109.  
  110.  
  111.  
  112.      1.USE CONDITIONS
  113.      Libraries cointained in this packet are fully functional only  with *.MDF
  114.      files produced with  a  REGISTERED  copy of  MDIFF, so you  can use  them
  115.      freely. Moreover you can distribute the  file MDFDLL.DLL if you need.
  116.      No fee is required, these libraries are totally royalty free.
  117.  
  118.  
  119.  
  120.      2.C++
  121.  
  122.      2.1.MPatch CLASS
  123.      To use this class  is not important to  know how it  operates or what  it
  124.      contains; but  is very  important to  understand how  its public  members
  125.      operate.
  126.  
  127.      MPatch()
  128.      MPatch() is the class constructor. Its function is to  initialize private
  129.      data.
  130.  
  131.      void SetRate(short r)
  132.      SetRate() changes the frequency of calling of Show().
  133.  
  134.      short MDFPatch(char *dif, char *old, char *new)
  135.      This is the main function. Its parameters are the name of .MDF  file, the
  136.      name of  the file  to patch  and the  name of  the file  it must  create.
  137.      Warning: old and new must not  contain equal strings. If old and  new are
  138.      empty strings ("\0") MDFPatch() will use the names contained in  the .MDF
  139.      file. The function must   return 0 or,  in case of  error a non-0  value.
  140.      Please, see later for details.
  141.  
  142.      char *LastError()
  143.      If there  were  errors in  using  MDFPatch() function,  LastError()  will
  144.      return a pointer to a string that  explain the error.
  145.  
  146.      void Show_start()
  147.      void Show()
  148.      void Show_end()
  149.      These 3 functions are useful to  show messages during patch  application.
  150.      Show_start() will  be   automatically called  from  MDFPatch() before  it
  151.      starts applying the patch. In the same way,  Show_end() will be called at
  152.      the end  of  the  process. Show()  is  called  during the  process  at  a
  153.      frequency   dependent  from  the  value  setted  with  SetRate().These  3
  154.      functions are virtual, so you must inherit MPatch  class to  change them.
  155.      See the SAMPLE.CPP for more details.
  156.  
  157.  
  158.  
  159.      2.2.ERROR TABLE
  160.      MDFPatch() returns values are defined as follows:
  161.         Code   Description
  162.          0     "OK!"
  163.          1     "Out of memory !"
  164.          2     "Can't open MDF file !"
  165.          3     "Invalid MDF file !"
  166.                                                                               3
  167.  
  168.  
  169.  
  170.  
  171.          4     "MDF file version mismatch !"
  172.          5     "UNREGISTERED !"
  173.          6     "Bad or incorrect OLD file !"
  174.          7     "Can't open OLD file !"
  175.          8     "Can't create NEW file !"
  176.          9     "General failure: NEW file corrupted !"
  177.          10    "OLD and NEW can't be the same file !"
  178.  
  179.  
  180.  
  181.      2.3.READING THE HEADER
  182.      The function used to read the  header of a *.MDF file  is the same for  C
  183.      and C++, so I'll explain it in  chapter 3.1.
  184.  
  185.  
  186.      3.C
  187.  
  188.      3.1.READING THE HEADER
  189.      Each *.MDF  file contains  a  header in  wich  are recorded  some  useful
  190.      information. We can read this  header using the readMDFhead() funcion:
  191.  
  192.      short readMDFhead(char *fn, struct MDF_header_info *hi)
  193.      fn argument is a pointer to the *.MDF  file name, and hi is a  pointer to
  194.      the structure where the function  will store the information read, and it
  195.      is defined as:
  196.  
  197.      struct MDF_header_info   {
  198.           char alg_ver[4];
  199.           char oldfilename[255];
  200.           char newfilename[255];
  201.           char registeredto[255];
  202.           char comment[2048];
  203.           unsigned long oldfilecrc;
  204.           short chunk_len;
  205.           unsigned long n_chunks;
  206.      };
  207.  
  208.      Where:
  209.      alg_ver          Version of the algorithm used to create  the
  210.                       *.MDF file
  211.      oldfilename      OLD file original name
  212.      newfilename      NEW file original name
  213.      registeredto     Owner's name of the the *.MDF file  (registered
  214.                       only)
  215.      comment          Comment
  216.      oldfilecrc       OLD file crc
  217.      chunk_len        Chunk lenght
  218.      n_chunks         Number of chunks
  219.  
  220.      Return value:
  221.          0    File not found
  222.          1    OK
  223.         -1    This is not a valid *.MDF file
  224.         -2    Incorrect version
  225.  
  226.                                                                               4
  227.  
  228.  
  229.  
  230.  
  231.      3.2.APPLY THE PATCH
  232.      To apply a *.MDF file you must call the MDFPatch() function:
  233.  
  234.      short MDFPatch(char *mfl,char *ofl,char *nfl)
  235.      Arguments are, in the order, the names of MDF, OLD and NEW file.
  236.      Function's return value follows the table of the chapter 3.2.
  237.      To have  a short  explanation of  the  error occourred  you can  use  the
  238.      MDFError() function:
  239.  
  240.      char *MDFError(short e)
  241.      The e argument is the number of the error.
  242.  
  243.  
  244.      4.VISUAL BASIC
  245.      You can use the Windows' DLL in VisualBasic but first of all  you have to
  246.      declare it in a global module:
  247.  
  248.       Declare Function MPATCH Lib "mdfdll.dll" Alias "@MPATCH$qnzct1t1" (ByVal
  249.            m As String, ByVal o As  String, ByVal n As String) As Integer
  250.  
  251.      Now you can call the function in a specified event:
  252.      r% = MPATCH(fmdf$, fold$, fnew$)
  253.      The arguments are,  in the order,  the names  of MDF, OLD  and NEW  file.
  254.      Function's return value follows  the table of chapter 2.2.
  255.  
  256.      Warning: MDFDLL.DLL must be in the path or in the same directory  of your
  257.      program!
  258.  
  259.  
  260.      5.AUTHOR'S ADDRESS
  261.      For any question you can contact me at:
  262.      My home address:
  263.                                    Maurizio Giunti
  264.                                 Via G.B. Foggini, 24
  265.                                     50142 Firenze
  266.                                         Italy
  267.  
  268.      My E-Mail address:
  269.                                 Fidonet: 2:332/102.3
  270.                           Internet: giunti@stat.ds.unifi.it
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.                                                                               5